#include "Ground.h"
#include <GL\glut.h>

Ground::Ground()
{

}

void Ground::Draw()
{
	glPushMatrix();

	btTransform btTrans;
	m_pMotionState->getWorldTransform(btTrans);
	btTrans.getOpenGLMatrix(m_mat.m_matrix);
	m_mat.MultiOpenGL();

	m_pCuboid->Draw();

	glPopMatrix();
}

Ground::Ground(const Vec3f& pos, unsigned int size)
{
	m_materialDensity = 1;
	//m_numFragments = numFragments;
	
	m_size = size;
	m_pCuboid = new GLCuboid((float)size, 2, (float)size);
	btBoxShape* shape = new btBoxShape(btVector3((float)size, 2, (float)size));
	CreateRigidBody(shape, 0);

	m_pRigidBody->setRestitution(0.9f);
	//void* v = this;

	btTransform trans;
	trans.setIdentity();
	trans.setOrigin(btVector3(pos.X, pos.Y, pos.Z));
	
	//SetPos(pos);
}

Ground::~Ground()
{

}

void Ground::Collided(btManifoldPoint& contact)
{
	int i = 0;
}

void Ground::Update()
{

}